<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="referer" content="never" />
  <meta name="renderer" content="webkit">
  <title>{{g.title}}</title>
  <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon" />
  <link href="{{g.cdn_url}}/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" />
  <link href="{{g.cdn_url}}/css/site.css?version={{g['version']}}&repair={{data['js_random']}}" rel="stylesheet" />
  {% for css_f in g['other_css'] %}
  <link href="{{css_f}}" rel="stylesheet" />
  {% endfor %}
  <style>
    .contextmenu {
      position: absolute;
      width: 120px;
      background: #FFFFFF;
      border-radius: 5px;
      overflow: hidden;
      z-index: 99999999;
    }

    .contextmenu li {
      border-left: 3px solid transparent;
      transition: ease 0.3s;
    }

    .contextmenu li:hover {
      background: #707070;
      border-left: 3px solid #333;
    }

    .contextmenu li a {
      display: block;
      padding: 5px 10px;
      color: #000000;
      text-decoration: none;
      transition: ease 0.3s;
      cursor: default;
    }

    .contextmenu li:hover a {
      color: #fff;
    }

    .toolbar-right{
      width: 35px;
      height: 150px;
      position: fixed;
      right: 0;
      bottom: 70px;
      background-color: #fff;
      border-top-left-radius: 4px;
      border-bottom-left-radius: 4px;
      box-shadow: 0 0 4px 0 #ccc;
    }
    .toolbar-right .service,
    .toolbar-right .feedback{
      display: inline-block;
      height: 75px;
      width: 35px;
      position: relative;
      background-repeat: no-repeat;
      background-position: center center;
      background-size: 13.5px;
    }
    .toolbar-right .service{
      background-image: url('/static/img/service.svg');
    }
    .toolbar-right .service:after{
      position: absolute;
      bottom: 0;
      left: 50%;
      margin-left: -9px;
      content: '';
      display: inline-block;
      width: 18px;
      border-bottom: 1px solid #ECECEC;
    }
    .toolbar-right .feedback{
      background-image: url('/static/img/feedback.svg');
    }
    .feedback-iframe .layui-layer-content{
      overflow: hidden !important;
    }
  </style>
  <script type="text/javascript">
    // 处理浏览器兼容性问题
    function browserCompatibility(){
      var ie = (function () {
        //ie版本
        var agent = navigator.userAgent.toLowerCase();
        return !!window.ActiveXObject || 'ActiveXObject' in window
                ? (agent.match(/msie\s(\d+)/) || [])[1] || (agent.indexOf('edge') > -1?'edge':false)  || (agent.indexOf('trident') > -1 && agent.indexOf('rv:11.0') > -1?'11':false) //由于ie11并没有msie的标识
                : false;
      })()
      if(typeof ie !== "boolean" && ie !== 'edge') ie = parseInt(ie);
      if(ie < 11 && typeof ie !== "boolean"){
        window.location.href = '/tips';
      }else if(ie){
        var title = document.createElement('div');
        title.setAttribute('class', 'content');
        title.setAttribute('style','height: 50px;position: absolute;top: 0;left: 0;right: 0;line-height: 50px;z-index: 9999999;background: rgba(0,0,0,.5);text-align: center;color: #ff922e;font-size: 19px;font-weight: 600;');
        title.innerHTML = '<span>当前浏览器可能存在视图不兼容的情况，推荐使用Chrome/FireFox/国产浏览器急速模式访问</span><span class="compatibility_tips" style="position: absolute;right: 15px;top: 10px;font-size: 14px;display: inline-block; height: 30px;line-height: 28px;padding: 0 12px;font-weight: 500;color: #ffffff; border-radius: 4px;cursor: pointer;border: 2px solid #ffffff;font-weight: 500;">关闭提示</span>';
        title.querySelector('.compatibility_tips').addEventListener('click',function(res){
          var parentNode = this.parentElement;
          parentNode.parentElement.removeChild(parentNode)
        })
        var style = document.createElement('style');
        style.setAttribute('type','text/css');
        style.innerHTML = '.sidebar-scroll .mypcip span{background-position: -20px;background-size: 65px;}.bind-user{background-position: -35px;}.bt-dashi{background-position: -30px;}.bt-dashi{background-position: -30px;}.ico-system{background-position: -15px;}.btltd{background-position: -80px;}';
        var html = document.querySelector('html')
        html.appendChild(title)
        html.appendChild(style)
      }
      if (!window.location.origin) {
        window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
      }
      return ie;
    }

    // 修复浏览器当前分辨率（包括当前浏览和系统提供的显示缩放），小于1920则进行修复，大于1920则不修复
    function repairResolution(){
      var ratio = (function getRatio(){
        var ratio=0;
        var screen=window.screen;
        var ua=navigator.userAgent.toLowerCase();
        if(window.devicePixelRatio !== undefined){
          ratio=window.devicePixelRatio;
        } else if(~ua.indexOf('msie')) {
          if(screen.deviceXDPI && screen.logicalXDPI) {
            ratio=screen.deviceXDPI/screen.logicalXDPI;
          }
        }else if(window.outerWidth !== undefined && window.innerWidth !== undefined) {
          ratio=window.outerWidth/window.innerWidth;
        }
        if(ratio) {
          ratio=Math.round(ratio*100);
        }
        return ratio;
      })();
      var availWidth = window.screen.availWidth, actualWidth = availWidth * ratio;
      var __zoom = 1;  //需要缩放的比例
      if(availWidth < 1920){
        __zoom = (availWidth / 1920).toFixed(1)
        if(__zoom <= .7) __zoom = .7
        document.querySelector('html').style.zoom = __zoom;
      }
      return __zoom;
    }

    var ie_version = browserCompatibility()
    // var __zoom = repairResolution()
  </script>
</head>

<body>
  <div class="bt-warp bge6">
    <a style="display:none;" id="panel_debug" data="{{g['debug']}}" data-pyversion="{{g['pyversion']}}"></a>
    <a style="display:none;" id="request_token_head" token="{{session[g.get_csrf_html_token_key]}}"></a>
    <a style="display:none;" id="is_soft_flush" data="{{session['is_flush_soft_list']}}"></a>
    <div class="public_key" style="display: block;" data="{{session['rsa_public_key']}}"></div>
    <div id="container" class="container-fluid">
      <div class="sidebar-scroll">
        <div class="sidebar-auto">
          <div id="task" class="task cw" onclick="messagebox()">0</div>
          <h3 class="mypcip"><span class="f14 cw" title="单击可显示/隐藏IP，双击可复制IP">{{session['address']}}</span></h3>
          <ul class="menu">
            {% for menu in g['menus'] %}
            {% if menu['href'] == g.uri %}
            <li id="{{menu['id']}}" class="current"> <a class="{{menu['class']}}"
                href="{{menu['href']}}">{{menu['title']}}</a></li>
            {% else %}
            <li id="{{menu['id']}}"> <a class="{{menu['class']}}" href="{{menu['href']}}">{{menu['title']}}</a></li>
            {% endif %}
            {% endfor %}
          </ul>
        </div>
      </div>
      <button style="display: none;" id="bt_copys" class="bt_copy" data-clipboard-text=""></button>
      <a style="display: none;" id="defaultPath">{{session['config']['sites_path']}}</a>
      {% block content %}{% endblock %}
      <!-- <div id="wechat-customer" class="wechat-customer hide" >
        <div class="describe-title">在线客服</div>
        <div class="qrcode-wechat">
          <div id="wechatCustomerQrcode"><img src="/static/images/customer-qrcode.png" /></div>
        </div>
        <div class="wechat-title">
          <img class="icon" src="" />
          <span class="scan-title">微信扫码</span>
        </div>
        <span class="layui-layer-setwin wechat-close"><a href="javascript:;" class="layui-layer-ico layui-layer-close layui-layer-close2"></a></span>
      </div> -->
      <div id="wechat-customer" class="wechat-customer hide">
        <div class="describe-title">在线客服</div>
        <div class="qrcode-wechat">
          <div id="wechatCustomerQrcode">
            <img src="/static/images/customer-qrcode.png"  style="width: 80px;height: 80px;" alt="" />
          </div>
        </div>
        <div class="wechat-title">
        <img class="icon" src="">
        <span class="scan-title">微信扫码</span></div>
        <hr style="width: 88px;height: 1px;background: #E6E6E6;margin: 10px auto;">
        <div><a href="https://www.bt.cn/new/wechat_customer" target="_blank" class="btlink">点击咨询客服<div class="icon-r"></div></a></div>
        <span class="layui-layer-setwin wechat-close"><a href="javascript:;" class="layui-layer-ico layui-layer-close layui-layer-close2"></a></span>
      </div>
      <div class="toolbar-right hide">
        <a href="javascript:;" class="service" title="在线客服"></a>
        <a href="javascript:;" class="feedback" title="反馈调研"></a>
      </div>
      <div class="footer bgw">
        Linux Panel &copy; {{g['yaer']}}
      </div>
    </div>
    {% if g.cdn_url != '/static' %}
    <script type="text/javascript">
      function static_cdn_check(msg, url, line, col, error) {
        if (msg.indexOf('$ is not defined') != -1) {
          var s_url = '/static_cdn/set_state.json';
          http_request = new XMLHttpRequest();
          http_request.open('GET', s_url, true);
          http_request.setRequestHeader("Content-type", "application/json");
          http_request.send();
          http_request.onreadystatechange = function (e) {
            if (e.srcElement.readyState == 4 && e.srcElement.status == 200) {
              if (e.srcElement.responseText.indexOf('true') != -1) {
                alert("检测到【面板静态加速】节点故障，已自动关闭加速功能\n若需要继续使用【面板静态加速】功能，请在软件商店尝试手动重新开启\n\n点击确定刷新页面!")
                window.location.reload();
              }
            }
          }
        }
      }
      window.onerror = static_cdn_check;
    </script>
    {% endif %}
    <script type="text/javascript">
      var recycle_bin_db_open = "{{g['recycle_bin_db_open']}}" === "1",
              recycle_bin_open = "{{g['recycle_bin_open']}}" === "1",
              update_code = "{{data['js_random']}}",
              panel_version = "{{g['version']}}",
              cdn_url = "{{g.cdn_url}}";
    </script>
    {% if request.path == '/btwaf/index' %}
    <script type="text/javascript" src="{{g.cdn_url}}/js/jquery-2.2.4.min.js"></script>
    <script type="text/javascript" src="{{g.cdn_url}}/layer/layer.js?version={{g['version']}}"></script>
    <script type="text/javascript" src="{{g.cdn_url}}/language/{{session['lan']}}/lan.js?version={{g['version']}}&repair={{data['js_random']}}"></script>
    <script type="text/javascript" src="{{g.cdn_url}}/js/clipboard.min.js" defer></script>
    <script type="text/javascript" src="{{g.cdn_url}}/laydate/laydate.js" defer></script>
    <script type="text/javascript" src="{{g.cdn_url}}/js/jquery.qrcode.min.js"></script>
    <script type="text/javascript" src="{{g.cdn_url}}/js/public.js?version={{g['version']}}&repair={{data['js_random']}}&patch=1"></script>
    <script type="text/javascript" src="{{g.cdn_url}}/js/public_backup.js?version={{g['version']}}&repair={{data['js_random']}}"></script>
    <script type="text/javascript" src="{{g.cdn_url}}/js/tools.js?version={{g['version']}}&repair={{data['js_random']}}"></script>
    {% endif %}

    {% block scripts %}
    <script src="{{g.cdn_url}}/js/jquery-2.2.4.min.js"></script>
    <script src="{{g.cdn_url}}/layer/layer.js?version={{g['version']}}"></script>
    <script src="{{g.cdn_url}}/language/{{session['lan']}}/lan.js?version={{g['version']}}&repair={{data['js_random']}}"></script>
    <script src="{{g.cdn_url}}/js/clipboard.min.js" defer></script>
    <script src="{{g.cdn_url}}/laydate/laydate.js" defer></script>
    <script type="text/javascript"  src="{{g.cdn_url}}/js/jquery.qrcode.min.js"></script>
		<script src="{{g.cdn_url}}/js/jsencrypt.min.js?version={{g['version']}}&repair={{data['js_random']}}"></script>


    <!-- 以下文件未来将被剔除 -->
    <script src="{{g.cdn_url}}/js/bootstrap.min.js"></script>
    <script src="{{g.cdn_url}}/js/public.js?version={{g['version']}}&repair={{data['js_random']}}&patch=1"></script>
    <script src="{{g.cdn_url}}/js/public_backup.js?version={{g['version']}}&repair={{data['js_random']}}"></script>
    <!-- End -->
    <script type="text/javascript" src="{{g.cdn_url}}/js/tools.js?version={{g['version']}}&repair={{data['js_random']}}"></script>
    <script type="text/javascript">
      window.localStorage.setItem('mypcip',"{{session['address']}}");
      var mypcip = window.localStorage.getItem('mypcip')
      var ipArr = mypcip.split('.'),numberIp = window.localStorage.getItem('mypcipShow')
      $('.mypcip .cw').text(numberIp !== null && parseInt(numberIp) ? ipArr[0] + '.***.***.' + ipArr[ipArr.length - 1] : mypcip);
      numberIp !== null && parseInt(numberIp) ? $('.mypcip').removeClass('active') : $('.mypcip').addClass('active')

      $('.mypcip').mousedown(function () {
        var stime = new Date().getTime();//当前时间
        $(this).mouseup(function (e) {
          if(new Date().getTime() - stime < 200) {//鼠标按下和松开的时间间隔小于200为点击事件
            var is_show = $(this).hasClass('active')
            $('.mypcip .cw').text(is_show ? ipArr[0] + '.***.***.' + ipArr[ipArr.length - 1] : mypcip);
            window.localStorage.setItem('mypcipShow',is_show ? 1 : 0);
            if(is_show) $(this).removeClass('active');
            else $(this).addClass('active');
            e.stopPropagation()
            e.preventDefault()
          }
        });
      })
      $('.mypcip').on('dblclick', function () {
        bt.pub.copy_pass(mypcip);
        bt_tools.msg({msg:'复制成功',status: true});
      })

      bt.set_cookie('order', 'id desc');
      bt.set_cookie('serverType', "{{session['webserver']}}");
      if (bt.get_cookie('pro_end') >= 0 || bt.get_cookie('ltd_end') > 0) $(".bt_qq_qun").show()

      $('#onlineCustomer').click(function (){
        var customer = $("#wechat-customer");
        var ltd_end = bt.get_cookie('ltd_end');
        if (!(ltd_end > 0)){
          if(!$('#pay_product_view').length > 0){
            product_recommend.pay_product_sign('ltd',45,'ltd');
            layer.msg('在线客服仅支持企业版用户使用', {icon: 5});
          }
          return false;
        }else{
          if(customer.hasClass('hide')){
            customer.removeClass('hide');
          }else{
            customer.addClass('hide');
          }
        }
      })

      $('#wechat-customer .wechat-close').on('click',function(){
        $(this).parent().addClass('hide');
      })
      $('.toolbar-right .service').on('click',function(){
        $('#wechat-customer').removeClass('hide')
      })

      $('.toolbar-right .feedback').on('click',function(){
        if($('.nps_survey').length >= 1) return false;  //防止多层
        layer.open({
          type:1,
          title:false,
          btn:false,
          area:'520px',
          skin:'nps_survey',
          closeBtn: 2,
          content:'<div class="nps_survey_box"">\
	           <div class="nps_survey_banner">\
	                <span>\
	                    <i></i>\
	                    <span style="vertical-align: 4px;">宝塔面板NPS问卷</span>\
	                </span>\
	           </div>\
	           <div style="padding:12px 40px 40px;">\
    	           <div class="nps_survey_score">\
    	                <div class="survey_title">基于本次使用，您是否愿意把宝塔面板推荐给朋友？</div>\
    	                <div class="score_title"><span style="font-weight: normal;">请从0-10打个分</span></div>\
    	                <ul class="survey_score_num initbg">\
    	                    <li>0</li>\
    	                    <li>1</li>\
    	                    <li>2</li>\
    	                    <li>3</li>\
    	                    <li>4</li>\
    	                    <li>5</li>\
    	                    <li>6</li>\
    	                    <li>7</li>\
    	                    <li>8</li>\
    	                    <li>9</li>\
    	                    <li>10</li>\
    	                </ul>\
    	                <div style="color: #999;display: flex;justify-content: space-between;margin-top: 5px;margin-left: -15px;width: 460px;"><span>非常不愿意</span><span>非常愿意</span></div>\
    	           </div>\
    	           <div class="nps_survey_content hide">\
    	                <div class="nps_survey_line">\
    	                    <span class="nps_survey_title"><i>*</i>1.您是通过什么方式了解使用宝塔面板的？用宝塔面板解决<b>什么问题</b>？</span>\
    	                    <p>使用宝塔多久了，使用频率如何等</p>\
    	                    <input type="text" name="problem_one">\
    	                </div>\
    	                <div class="nps_survey_line">\
    	                    <span class="nps_survey_title"><i>*</i>2.您在使用宝塔面板过程中出现<b>最多的问题</b>是什么?</span>\
    	                    <p>我们希望找出问题，帮助我们改进产品</p>\
    	                    <input type="text" name="problem_two">\
    	                </div>\
    	                <div class="nps_survey_line">\
    	                    <span class="nps_survey_title"><i>*</i>3.谈谈您对宝塔面板的<b>建议</b>。</span>\
    	                    <p>您的建议一旦被采纳很可能在下一个版本更新发布</p>\
    	                    <input type="text" name="problem_three">\
    	                </div>\
    	                <button class="btn btn-success set_survey_info pull-right" style="margin: 25px 0 30px;padding: 6px 40px;">提交</button>\
    	           </div>\
    	       </div>\
	        </div>\
	        <style>\
	        .nps_survey_banner{position: relative;background: url(/static/img/feedback/QA_banner.png);width:100%;background-size: 100%;height: 123px;}\
	        .nps_survey_banner>span{position: absolute;left: 32px;top: 16px;font-size: 17px;color: #fff;}\
	        .nps_survey_banner i{background-image: url(/static/images/svg/logo-white.svg);background-repeat: no-repeat;background-size: 18px;display: inline-block;width: 20px;height: 20px;}\
	        .survey_title {font-size: 16px;font-weight: bold;text-align: center;}\
	        .score_title{font-size:16px;font-weight:bold;color:#1677ff;text-align:center;height: 50px;line-height: 60px;}\
	        .nps_survey_score ul{margin-top:10px}\
	        .nps_survey_score li {position:relative;display: inline-block;font-size: 14px;color: #1677ff;width: 32px;height: 32px;margin-right: 5px;border: 1px solid #D0D0D0;border-radius: 20px;text-align: center;line-height: 32px;cursor: pointer;background-color:#CFF3D7;font-weight: bold;}\
	        .nps_survey_score li:last-child{margin-right:0;}\
	        .survey_score_num.initbg li{background-color:#fff;font-weight: inherit}\
	        .survey_score_num li.wafA{border:none}\
	        .survey_score_num li.wafA:before{content: "";background: url(/static/img/feedback/QA_emoj.png);background-size: 99%;width: 32px;height: 32px;display: inline-block;position: absolute;left: -1px;top: -1px;}\
	        .nps_survey_content{margin-top: 25px;}\
	        .nps_survey_line{ font-size:14px;}\
	        .nps_survey_line .nps_survey_title{margin:20px 0 7px 0;display:block;font-weight: bold;}\
	        .nps_survey_line p{color:#999;font-size:12px;margin-bottom:5px;}\
	        .nps_survey_line i,.nps_survey_line b{color:#FC6D26;font-style: inherit;}\
	        .nps_survey_line input{width:440px;height:28px;border:1px solid #E0E0E0;font-size:12px;}\
	        .survey_score_num li:nth-child(2).wafA:before{background-position: 0 328px;}\
	        .survey_score_num li:nth-child(3).wafA:before{background-position: 0 295px;}\
	        .survey_score_num li:nth-child(4).wafA:before{background-position: 0 262px;}\
	        .survey_score_num li:nth-child(5).wafA:before{background-position: 0 229px;}\
	        .survey_score_num li:nth-child(6).wafA:before{background-position: 0 196px;}\
	        .survey_score_num li:nth-child(7).wafA:before{background-position: 0 163px;}\
	        .survey_score_num li:nth-child(8).wafA:before{background-position: 0 130px;}\
	        .survey_score_num li:nth-child(9).wafA:before{background-position: 0 97px;}\
	        .survey_score_num li:nth-child(10).wafA:before{background-position: 0 64px;}\
	        .survey_score_num li:nth-child(11).wafA:before{background-position: 0 32px;}\
	        </style>',
          success:function(layers,indexs){
            //客服电话咨询
            $('.nps-kf-box').click(function (ev) {
              if ($(this).find('i').hasClass('active')) {
                $(this).find('i').removeClass('active');
                $(this).find('input').prop('checked', false)
              } else {
                $(this).find('i').addClass('active');
                $(this).find('input').prop('checked', true)
              }
              ev.preventDefault();
            })
            var goNum = 0;
            //评分栏目鼠标经过事件
            $('.survey_score_num').on('mouseenter','li',function(){
              $('.nps_survey_content').removeClass('hide')
              $('.survey_score_num').removeClass('initbg')
              if(goNum < 1) {
                $(window).resize()
                goNum++
              }
              var _mouseScore = $(this).index(),
                      _scoreText = ''
              if(!$(this).hasClass('wafA')){
                $(this).addClass('wafA').siblings().removeAttr('class')
                if(_mouseScore <= 6){
                  _scoreText = '<span style="color:#E43434">'+_mouseScore+'分，不愿意</span>'
                  if(_mouseScore == 0) _scoreText = '<span style="color:#E43434">'+_mouseScore+'分，非常不愿意</span>'
                }else if(_mouseScore == 7 || _mouseScore == 8){
                  _scoreText = _mouseScore+'分，一般'
                }else{
                  _scoreText = _mouseScore+'分，愿意'
                  if(_mouseScore == 10) _scoreText = _mouseScore+'分，非常愿意'
                }

                //设置评分颜色
                $(this).prevAll().removeAttr('style')
                $(this).nextAll().attr('style','background-color:#fff;font-weight: inherit;')
                $(this).css('background-color','#fff')

                $('.score_title').html(_scoreText)
              }
            })
            // 设置调查信息
            $('.set_survey_info').click(function(){
              var _score = $('.wafA').index(),
                      _one = $('input[name=problem_one]').val(),
                      _two = $('input[name=problem_two]').val(),
                      _three = $('input[name=problem_three]').val()

              _one = _one == '' ? ' ' : _one
              _two = _two == '' ? ' ' : _two
              _three = _three == '' ? ' ' : _three
              $.post('/config?action=write_nps',{software_name:'panel',product_type:0,rate:_score,questions:JSON.stringify({
                          "LMdrUlYWLMjhjYjczNTUyMDIwcoCSWTt": _one,
                          "PCpsJvGUmMjRjYjczNTUyMDExLGAMKPd": _two,
                          "IYlVujIciMmM4YjczNTUyMDMzfselTpB":_three})},
                      function (rdata) {
                        if(rdata.status){
                          layer.close(indexs)
                          layer.open({
                            title: false,
                            btn: false,
                            shadeClose: true,
                            shade:0.1,
                            closeBtn: 0,
                            skin:'qa_thank_dialog',
                            area: '230px',
                            content: '<div class="qa_thank_box" style="background-color:#F1F9F3;text-align: center;padding: 20px 0;"><img src="/static/img/feedback/QA_like.png" style="width: 55px;"><p style="margin-top: 15px;">感谢您的参与!</p></div>',
                            success: function (layero,index) {
                              $(layero).find('.layui-layer-content').css({'padding': '0','border-radius': '5px'})
                              $(layero).css({'border-radius': '5px','min-width': '230px'})

                              setTimeout(function(){layer.close(index)},3000)
                            }
                          })
                        }
                      });
            })
          }
        })
      })

      {% if data['show_workorder'] %}
      $('.debugs').removeClass('hide');
      {% endif %}

      $("#setBox").click(function () {
        if ($(this).prop("checked")) {
          $("input[name=id]").prop("checked", true);
        } else {
          $("input[name=id]").prop("checked", false);
        }
      });
      var is_files_html = false;
      var task_open = 0;
      var task_close = false;
      if ($(".current").attr("id") === 'memuAfiles') {
        is_files_html = true;
      }

      function task_stat(my_init) {
        if (!my_init) {
          my_init = 0;
          if (task_open) return;
        }
        if (task_close) return;
        $.post('/task?action=get_task_lists', {
          status: -3
        }, function (task_list) {
          if (task_list.length == 0) {
            if (my_init && is_files_html) GetFiles(getCookie('Path'));
            if (task_open) {
              layer.close(task_open);
              task_open = false;
            }
            return;
          }
          var msg_body = '';
          var is_add = false;
          for (var i = 0; i < task_list.length; i++) {
            if (task_list[i]['status'] == -1) {
              if (!task_open || !$(".message-list").attr("class")) {
                show_task();
              }

              if (task_list[i]['type'] == '1') {
                msg_body +=
                        '<div class="mw-con">\
                                              <ul class="waiting-down-list">\
                                                  <li>\
                                                      <div class="down-filse-name"><span class="fname" style="width:80%;" title="正在下载: ' +
                        task_list[i].shell + '">正在下载: ' + task_list[i].shell +
                        '</span><span style="position: absolute;left: 84%;top: 25px;color: #999;">' + task_list[i].log
                                .pre + '%</span><span class="btlink" onclick="remove_task(' + task_list[i].id + ')" style="position: absolute;top: 25px;right: 20px;">取消</span></div>\
                                          <div class="down-progress"><div class="done-progress" style="width:' + task_list[i]
                                .log.pre + '%"></div></div>\
                                          <div class="down-info"><span class="total-size"> ' + task_list[i].log.used + '/' +
                        ToSize(task_list[i].log.total) + '</span><span class="speed-size">' + (task_list[i].log.speed ==
                        0 ? '正在连接..' : task_list[i].log.speed) + '/s</span><span style="margin-left: 20px;">预计还要: ' +
                        task_list[i].log.time + '</span></div>\
                                        </li>\
                                            </ul>\
                                        </div>'
              } else {
                msg_body +=
                        '<div class="mw-title"><span style="max-width: 88%;display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">' +
                        task_list[i].name + ': ' + task_list[i].shell +
                        '</span><span class="btlink" onclick="remove_task(' + task_list[i].id + ')"  style="position: absolute;top: 10px;right: 15px;">取消</span></div>\
                                        <div class="mw-con codebg">\
                                          <code>' + task_list[i].log + '</code>\
                                        </div>'

              }

            } else {
              if (!is_add) {
                msg_body += '<div class="mw-title">等待执行任务</div><div class="mw-con"><ul class="waiting-list">';
                is_add = true;
              }
              msg_body += '<li><span class="wt-list-name" style="width: 90%;">' + task_list[i].name + ': ' +
                      task_list[i].shell + '</span><span class="mw-cancel" onclick="remove_task(' + task_list[i].id +
                      ')">X</span></li>';
            }
          }
          if (task_open) {
            if (is_add) {
              msg_body += '</ul></div>';
            }
            $(".message-list").html(msg_body);
          }


          if (my_init > 3) {
            if (is_files_html) GetFiles(getCookie('Path'));
            my_init = 1;
          }
          my_init += 1
          setTimeout(function () {
            task_stat(my_init);
          }, 1000);
        });
      }

      function show_task() {
        task_open = layer.open({
          type: 1,
          title: "实时任务队列",
          area: '500px',
          closeBtn: 2,
          shadeClose: false,
          shade: false,
          offset: 'auto',
          content: '<div style="margin: 10px;" class="message-list"></div>',
          cancel: function () {
            task_close = true;
          }
        });
      }

      function remove_task(id) {
        layer.confirm('是否取消当前执行的任务队列？', { title: '取消任务队列', icon: 0 }, function(indexs) {
          layer.close(indexs);
          var loadT = bt.load('正在取消任务...');
          $.post('/task?action=remove_task', {
            id: id
          }, function (rdata) {
            loadT.close();
            layer.msg(rdata.msg);
          });
        });
      }
      task_stat();

      // 获取支付状态
      function getPaymentStatus(){
        bt.send('get_pd', 'ajax/get_pd', {}, function (res) {
          var tab = $('.pos-box .tab-list'),
                  proHTML = '',
                  _index = res[1] > 0 ? 1 : 2,
                  is_pay = res[1] >= 0 || res[2] > 0, //是否购买
                  advanced = res[1] == 0 || res[1] > 0 ? 'pro':'ltd';
          if(is_pay){
            proHTML = '<div class="product-buy" style="margin-right:0;font-size: 12px;">到期时间：<span style="vertical-align: initial">'+(res[1] === 0?'永久授权':((res[1] === -2 || res[2] === -2)?'已过期':bt.format_data(res[_index],'yyyy-MM-dd'))+ '&nbsp;&nbsp;<a class="btlink" href="javascript:;" onclick="product_recommend.pay_product_sign(\''+ advanced +'\',81,\''+ advanced +'\')">续费</a>')+'</span></div>'
          }else {
            // proHTML = '<div class="product-buy" style="margin-right:0;"><button type="button" class="btn btn-success btn-xs" style="vertical-align: 1px;" onclick="product_recommend.pay_product_sign(\'ltd\',80,\'ltd\')">立即升级</button></div>'
            proHTML = ''
          }
          if((tab.children().length*105 + 306.28) < tab.parent().width()){
            tab.parent().css({display:'flex','justify-content':'space-between'});
            // var _html = '<div class="authState" style="line-height: 45px;padding-right: 20px;"><span class="'+(!is_pay?'btltd-gray':'bt'+advanced)+'" style="vertical-align: bottom;"></span><div style="display: inline-block;font-size: 12px" class="mr10">'+(!is_pay?'版本：v':'')+'{{session["version"]}}</div> ' + proHTML +'</div>'
            var _html = '<div class="authState" style="line-height: 45px;padding-right: 10px;"><div style="display: inline-block;font-size: 12px" class="mr10">'+(!is_pay?'版本：v':'')+'{{session["version"]}}</div> ' + proHTML +'</div>'
            if(tab.next().hasClass('authState')) tab.next().remove()
            tab.after(_html);
          }
        })
      }
      if(bt.get_cookie('bt_user_info') == null || bt.get_cookie('bt_user_info') == ''){
        bt.pub.get_user_info(function(userInfo){
          if (userInfo.status) {
            bt.set_cookie('bt_user_info', JSON.stringify(userInfo));
            getPaymentStatus();
          }
        })
      }else{
        getPaymentStatus();
      }

    </script>
    {% endblock %}
    <script type="text/javascript">
      {% if data['show_workorder'] %}
      $('.toolbar-right').removeClass('hide');
      {% endif %}
    </script>
    {% for js_f in g['other_js'] %}
    <script type="text/javascript" src="{{js_f}}"></script>
    {% endfor %}
  </div>
</body>

</html>